}
fn unwrap(self) -> Box<Writer+'a> {
- fail!("Can't unwrap a Shell");
+ panic!("Can't unwrap a Shell");
}
fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {
.with_precise(Some("locked".to_string()))
}
"path" => SourceId::for_path(&Path::new(url.slice_from(5))).unwrap(),
- _ => fail!("Unsupported serialized SourceId")
+ _ => panic!("Unsupported serialized SourceId")
}
}
pub fn to_url(&self) -> String {
match *self.inner {
SourceIdInner { kind: PathKind, .. } => {
- fail!("Path sources are not included in the lockfile, \
+ panic!("Path sources are not included in the lockfile, \
so this is unimplemented")
},
SourceIdInner {
PathKind => {
let path = match self.inner.url.to_file_path() {
Ok(p) => p,
- Err(()) => fail!("path sources cannot be remote"),
+ Err(()) => panic!("path sources cannot be remote"),
};
box PathSource::new(&path, self) as Box<Source>
},
let reference = match source_id.git_reference() {
Some(reference) => reference,
- None => fail!("Not a git source; id={}", source_id),
+ None => panic!("Not a git source; id={}", source_id),
};
let remote = GitRemote::new(source_id.get_url());
macro_rules! call( ($e:expr) => ({
if $e == 0 {
- fail!("failed {}: {}", stringify!($e), os::last_os_error())
+ panic!("failed {}: {}", stringify!($e), os::last_os_error())
}
}) )
// TODO: return something different than a ProjectBuilder
pub fn build(&self) -> &ProjectBuilder {
match self.build_with_result() {
- Err(e) => fail!(e),
+ Err(e) => panic!(e),
_ => return self
}
}
os::getenv("CARGO_BIN_PATH").map(Path::new)
.or_else(|| os::self_exe_path())
.unwrap_or_else(|| {
- fail!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
+ panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
})
}
(None, Some(e)) => {
Some(format!("{:3} - |{}|\n +\n", i, e))
},
- (None, None) => fail!("Cannot get here")
+ (None, None) => panic!("Cannot get here")
}
});
fn assert(self) -> T {
match self {
Ok(val) => val,
- Err(err) => fail!("Result was error: {}", err)
+ Err(err) => panic!("Result was error: {}", err)
}
}
}
fn assert(self) -> T {
match self {
Some(val) => val,
- None => fail!("Option was None")
+ None => panic!("Option was None")
}
}
}
.file("src/lib.rs", r#"
"#)
.file("examples/dont-run-me-i-will-fail.rs", r#"
- fn main() { fail!("Examples should not be run by 'cargo test'"); }
+ fn main() { panic!("Examples should not be run by 'cargo test'"); }
"#);
assert_that(p.cargo_process("bench"),
execs().with_status(0));
name = "foo"
"#)
.file("src/foo.rs", r#"
- fn main() { fail!("nope") }
+ fn main() { panic!("nope") }
"#);
assert_that(build.cargo_process("build"), execs().with_status(0));
name = "bar"
"#)
.file("src/bar.rs", r#"
- fn main() { fail!("nope") }
+ fn main() { panic!("nope") }
"#);
assert_that(build2.cargo_process("build"), execs().with_status(0));
authors = []
"#)
.file("src/main.rs", r#"
- fn main() { if !cfg!(ndebug) { fail!() } }
+ fn main() { if !cfg!(ndebug) { panic!() } }
"#);
assert_that(p.cargo_process("run").arg("--release"),
.file("src/lib.rs", r#"
"#)
.file("examples/dont-run-me-i-will-fail.rs", r#"
- fn main() { fail!("Examples should not be run by 'cargo test'"); }
+ fn main() { panic!("Examples should not be run by 'cargo test'"); }
"#);
assert_that(p.cargo_process("test"),
execs().with_status(0));
"#)
.file("src/lib.rs", "
#[test]
- fn foo() { fail!() }
+ fn foo() { panic!() }
");
assert_that(p.cargo_process("test").arg("--no-run"),